﻿using System;
using System.Collections.Generic;
using System.Text;
using HutongGames.PlayMaker;
using UnityEngine;

namespace AddOn
{
    [AddComponentMenu("PlayMaker/FsmDevice")]
    [Serializable, ExecuteInEditMode]
    public class FsmUnit : MonoBehaviour, INameable, IComparable, IBlock
    {
        public List<PlayMakerFSM> fsms = new List<PlayMakerFSM>();

        public string Name
        {
            get { return this.name; }
        }

        public int CompareTo(object obj)
        {
            throw new NotImplementedException();
        }

        void Start()
        {
            RebuildFSMs();
        }

        private void RebuildFSMs()
        {
            fsms.Clear();
            PlayMakerFSM[] us = this.GetComponentsInChildren<PlayMakerFSM>();
            fsms.AddRange(us);
        }

        [SerializeField]
        private Rect position = new Rect(0, 0, 100, 50);

        public Rect Position
        {
            get
            {
                return position;
            }
            set
            {
                position = value;
            }
        }
    }
}
